package edu.ynu.se.xiecheng.achitectureclass.device.entity;

import edu.ynu.se.xiecheng.achitectureclass.common.entity.LogicEntity;
import edu.ynu.se.xiecheng.achitectureclass.greenhouse.entity.Greenhouse;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

/**
 * 设备实体类
 */
@Getter
@Setter
@Entity
@Table(name = "device")
public class Device extends LogicEntity {

    @Column(name = "device_number", unique = true, nullable = false)
    private String deviceNumber;

    @Column(name = "name", nullable = false)
    private String name;

    @Column(name = "category", nullable = false)
    private String category;

    @Column(name = "unit")
    private String unit;

    @Column(name = "monitoring_address")
    private String monitoringAddress;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "greenhouse_id")
    private Greenhouse greenhouse;
}
